package zookeeper;

import org.apache.thrift.transport.TSocket;

/**
 * 抽象TSocket提供商 ThriftConnectionProvider 负责具体实现
 * @author  Administrator
 */

public interface ConnectionProvider {
    /**
	 * 取链接池中的一个链接
	 * @return   conn
	 * @uml.property  name="connection"
	 * @uml.associationEnd  
	 */
    public TSocket getConnection();

    /**
     * 返回链接
     *
     * @param socket socket
     * @param hasError has error when using this object
     */
    public void returnCon(TSocket socket, boolean hasError);

    /**
     * close all connection
     */
    public void close();
}
